<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <script type="text/javascript" src="${ctx}/assets/js/jquery-1.7.1.min.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript">
        function addUser() {
            var form = document.forms[0];
            form.action = "${ctx}/user/addUser";
            form.method = "post";
            form.submit();
        }
        function sendcode() {
            var idField = document.getElementById("emailid");
            alert("emailid");
            $.get("${ctx}/acount/getcode?id=" + escape(idField.value), function (data) {
                alert(data.result);
                if ("success" == data.result) {
                    alert("发送成功!");
                    window.location.reload();
                } else {
                    alert("发送失败!");
                }
            });
        }


    </script>
</head>
<body>
<h>邮箱验证</h>
<form name="userForm" action="">
    邮箱：<input type="text" name="Email" id="emailid" ">


    验证码：<input type="text" name="code">

    <input type="button" value="免费获取验证码" onclick="sendcode()">
    <!-- <input type="button" value="添加" onclick="addUser()"> <a id="sendAcodeBtn" href="javascript:sendcode());"><strong id="sendAcodeStg" >免费获取验证码</strong></a>-->


</form>


</body>
</html>